﻿using System;
using System.Collections.Generic;
using System.Windows;
using Caliburn.Micro;
using SS.WPF.Framework.Localization;

namespace TestFramework.ViewModels
{
    public class AddressBarViewModel : PropertyChangedBase, IWeakEventListener
    {
        private IList<object> _pathItems;
        public IList<object> PathItems
        {
            get
            {
                return this._pathItems;
            }
            set
            {
                this._pathItems = value;
                this.NotifyOfPropertyChange(() => this.PathItems);
            }
        }

        #region Implementation of IWeakEventListener

        /// <summary>
        /// Receives events from the centralized event manager.
        /// </summary>
        /// <returns>
        /// true if the listener handled the event. It is considered an error by the <see cref="T:System.Windows.WeakEventManager"/> handling in WPF to register a listener for an event that the listener does not handle. Regardless, the method should return false if it receives an event that it does not recognize or handle.
        /// </returns>
        /// <param name="managerType">The type of the <see cref="T:System.Windows.WeakEventManager"/> calling this method.</param><param name="sender">Object that originated the event.</param><param name="e">Event data.</param>
        public bool ReceiveWeakEvent(Type managerType, object sender, EventArgs e)
        {
            if (managerType == typeof(LanguageChangedEventManager))
            {
                this.NotifyOfPropertyChange(() => this.PathItems);
                return true;
            }
            return false;
        }

        #endregion
    }
}
